package com.gxa.security.controller;


import com.gxa.common.base.RespResult;
import com.gxa.security.dto.AddUserDTO;
import com.gxa.security.dto.FindUserDTO;
import com.gxa.security.dto.ResetPassword;
import com.gxa.security.entity.User;
import com.gxa.security.service.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/system/permission")
public class UserController {

    @Resource
    UserService userService;

    @GetMapping("/findAllUser")
    RespResult findAllUser(FindUserDTO findUserDTO) {
        return userService.findAllUser(findUserDTO);
    }

    @GetMapping("/findByUserId")
    RespResult findByUserId(long userId) {
        return userService.findByUserId(userId);
    }

    @PostMapping("/updateUser")
    RespResult updateUser(@RequestBody User user) {
        return userService.updateUser(user);
    }

    @PostMapping("/resetPassword")
    RespResult resetPassword(@RequestBody ResetPassword resetPassword) {
        return userService.resetPassword(resetPassword);
    }

    @GetMapping("/updateStatus")
    RespResult updateStatus(long userId) {
        return userService.updateStatus(userId);
    }

    @PostMapping("/addUser")
    RespResult addUser(@RequestBody AddUserDTO userDTO) {
        return userService.addUser(userDTO);
    }
}
